﻿#pragma once

#include <d3d12.h>

#include "../../../Common/d3dUtil.h"
#include "../../../Common/GameTimer.h"
using namespace  DirectX;


class VecAdd
{
public:
    VecAdd(ID3D12Device* device, ID3D12GraphicsCommandList* cmdList,int NumDataElements);
    VecAdd(const VecAdd& other) = delete;
    VecAdd& operator=(const VecAdd& other) = delete;
    ~VecAdd()=default;

    void DoComputeWork(
    ID3D12CommandAllocator* allocator,
    ID3D12GraphicsCommandList* cmdList,
    ID3D12RootSignature* rootSig,
    ID3D12PipelineState* pso);

    void AfterComputeWork();

private:
    struct Data
    {
        XMFLOAT3 v1;
        XMFLOAT2 v2;
    };
    
    //buffer A B
    Microsoft::WRL::ComPtr<ID3D12Resource> mInputBufferA;
    Microsoft::WRL::ComPtr<ID3D12Resource> mInputUploadBufferA;
    Microsoft::WRL::ComPtr<ID3D12Resource> mInputBufferB;
    Microsoft::WRL::ComPtr<ID3D12Resource> mBufferUpLoadB;

    //buffer output
    Microsoft::WRL::ComPtr<ID3D12Resource> mOutputBuffer;
    Microsoft::WRL::ComPtr<ID3D12Resource> mReadBackBuffer;
    int mNumDataElements;
};
